<?php 
/* themes the balances for a given user.
 * Available variables
 * $balances is an array of the form:
 * Array (
    [$cid] => Array (
      [cleared_balance] => themed quantity
      [pending_dif] => themed quantity
      [gross_in] => themed quantity
      [gross_out] => themed quantity
      [max_in] => themed quantity
      [max_out] => themed quantity
      [rating] => themed quantity
      [max] => themed quantity
      [min] => themed quantity
    )
  )
 * also $currencies = array() //generated by preprocess
 * plus the usual
 */
 //$currency = array_pop($currencies);
 //$themed_balances = array_pop($balances);
 ?>
 <table>
   <tr>
     <th></th>
     <?php foreach ($currencies as $currency) { ?>
     <th><?php print $currency->title; ?></th>
     <?php } ?>
   </tr>
   <tr>
     <th><?php print t('Cleared balance') ?></th>
     <?php foreach ($balances as $balance) { ?>
     <td><?php print $balance['cleared_balance']; ?></td>
     <?php } ?>
   </tr>
   <tr>
     <th><?php print t('Pending difference') ?></th>
     <?php foreach ($balances as $balance) { ?>
     <td><?php print $balance['pending_dif']; ?></td>
     <?php } ?>
   </tr>
   <tr>
     <th><?php print t('Total income') ?></th>
     <?php foreach ($balances as $balance) { ?>
     <td><?php print $balance['gross_in']; ?></td>
     <?php } ?>
   </tr>
   <tr>
     <th><?php print t('Spending limit') ?></th>
     <?php foreach ($balances as $balance) { ?>
     <td><?php print $balance['max_out']; ?></td>
     <?php } ?>
   </tr>
 </table>
